<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var arr = [3, 4, 1, 2, 6, 5]

        function paiXu(arr) {
            // arr = arr.sort(function (a, b) {
            //     return a - b
            // })
            for (var i = 1; i < arr.length; i++) {
                for (var j = 0; j < arr.length - 1; j++) {
                    if (arr[i] <= arr[j]) {
                        var temp = arr[i]
                        arr[i] = arr[j]
                        arr[j] = temp
                    }
                }
            }
            console.log(arr);
        }

        paiXu(arr);
    </script>
</head>

<body>

</body>

</html>